function searchDex() {
    Java.perform(function () {
    var ms = Process.enumerateModules();
    var LoadClassMembersaddr=null;
    var LoadMethodaddr=null;

    for (var i=0;i<ms.length;i++){
        var m =ms[i];
        // console.log("name-->"+JSON.stringify(m.name));
        var fs =m.enumerateSymbols();

         for (var j=0;j<fs.length;j++){
             var fm = fs[j]
             if (fm.name.indexOf("LoadClassMembers")>0 ){
                 LoadClassMembersaddr=fm.address;
             }
             if (fm.name.indexOf("LoadMethod")>0 && fm.name.indexOf("CheckLoadMethod")<0){
                 console.log(JSON.stringify(fm.name),fm.address,m.name)

                 LoadMethodaddr=fm.address;
             }
         }
    }


    // Interceptor.attach(LoadClassMembersaddr,{
    //     onEnter:function (args) {
    //         console.log("----------------------LoadClassMembersaddr---")
    //         var begin = args[2].add(Process.pointerSize).readPointer();
    //         var size = args[2].add(Process.pointerSize*2).readU32();
    //         console.log(hexdump(begin,{length:16}))
    //         console.log("size-->",size);
    //     },
    //     onLeave:function () {
    //
    //     }
    // })


    Interceptor.attach(LoadMethodaddr,{
        onEnter:function (args) {
            console.log("----------------------LoadMethodaddr---")
            var begin = args[2].add(Process.pointerSize).readPointer();
            var size = args[2].add(Process.pointerSize*2).readU32();
            console.log(hexdump(begin,{length:16}))
            console.log("size-->",size);




        },
        onLeave:function () {

        }
    })

    })


}


function use(){
    Java.perform(function () {

            var begin =null;
         //    打印类
            var classlist = Memory.readU32(begin.add(0x64));
            var typelist = Memory.readU32(begin.add(0x44));
            var str = Memory.readU32(begin.add(0x3c));

            var classes_size = Memory.readU32(begin.add(0x60))

            for (var n=0;n<classes_size;n++){
                var a = Memory.readU32(begin.add(classlist+n*0x20));
                a = Memory.readU32(begin.add(typelist+a*4));
                a = Memory.readU32(begin.add(str+a*4));
                var result = Memory.readCString(begin.add(a));
                result = result.replace(/\//g,".").slice(2).replace(/;/g,"");
                console.log(result);
            }

            for(var n in map2){
                try{
                    var us = Java.use(n);
                    var method = us.getDeclaredMethods();
                    var arg = new Array(100);
                    for(var m=0;m<100;m++){
                        arg[m]="321321";
                    }
                    var count = method[0].getParameterCount();
                    method[0].invoke(null,arg.slice(0,count));
                    
                }catch (e) {

                }
            }

    })
}

setTimeout(searchDex,1000);

//frida -U -f com.qiyi.video  -l unpack.js --no-pause
//frida -H 127.0.0.1:8888 -f com.qiyi.video  -l unpack.js --no-pause

/// adb forward tcp:8888  tcp:8888